package org.cdc.mre.manager;

import java.util.HashMap;
import java.util.Map;

public class ArgsManager {
    public static Map<String,String> format(String[] args){
        Map<String,String> maps = new HashMap<>();
        for (int index = 0 ;index <args.length;index++){
            String argName = args[index];
            String argValue = (index+1 < args.length)? args[index+1]:null;
            if (argName.startsWith("-")){
                if (argValue == null||argValue.startsWith("-")){
                    maps.put(argName,null);
                } else {
                    maps.put(argName,argValue);
                    index++;
                }
            }
        }
        return maps;
    }
}
